from fpioa_manager import fm

# need your connect hardware IO 9/10 to loopback
fm.register(24, fm.fpioa.UART1_TX, force=True) # 6 24
fm.register(25, fm.fpioa.UART1_RX, force=True) # 7 25

from machine import UART

uart_A = UART(UART.UART1, 115200, 8, 1, 0, timeout=1000, read_buf_len=4096)

import time

time.sleep_ms(100) # wait uart ready
uart_A.write(b'hello world')

while True:
  if uart_A.any():
    while uart_A.any():
      read_data = uart_A.read()
      print("recv = ", read_data) # 输出收到的数据
      uart_A.write(read_data+"\r")
    #break
  time.sleep_ms(10) # ohter event

uart_A.deinit()
del uart_A
